const mongoose = require('mongoose')

const schema = mongoose.Schema({
    title: String,
    // 因为文章的分类可以有多个，所以要写成数组形式
    categories: [{ type: mongoose.SchemaTypes.ObjectId, ref: 'Category' }],
    body: String
}, {
    timestamps: true
})

module.exports = mongoose.model('Article', schema)